#ifndef PARSE_C__
#define PARSE_C__

#include "../ast/module.h"
#include "token.h"
#include "parse-declaration.h"
#include "parse-import.h"

#if 0
import ..ast.module;
import token;
import parse-declaration;
import parse-import;
#endif

struct Module* parse(char* source)
{
	assert(source != NULL);

	#if DEBUG
	printf("parse()\n");
	#endif

	struct TokenList* tokens = tokenize(source);

	assert(tokens != NULL);

	#if DEBUG
	printf("Matched %i tokens.\n",tokenListLength(tokens));
	#endif

	struct ImportList* i = parseImportList(&tokens);
	struct DeclarationList* d = parseDeclarationList(&tokens);

	return allocateModule(i,d);
}

#endif
